﻿using System;

//Author: Morgan William Davis III
//Project: TRAC Ticket Manager v2
//Date: 14 Mar 2014

namespace TRACv2.Domain.Entities
{
    public class Ticket
    {

        #region [ Fields ]

        private int _id;
        private string _number;
        private DateTime _dateCreated;
        private int _contact;
        private int _creator;
        private int _assigned;
        private TRACv2.Common.Enumerations.Issue _issue;
        private TRACv2.Common.Enumerations.Priority _priority;
        private TRACv2.Common.Enumerations.Status _status;
        private string _note;

        #endregion

        #region [ Properties ]

        public int ID
        {
            get { return _id; }
            set
            {
                if(value < 1)
                    throw new ArgumentOutOfRangeException("value", "ID must be greater than 1.");
                _id = value;
            }
        }

        public string Number
        {
            get { return _number; }
            set
            {
                if (String.IsNullOrWhiteSpace(value) || value.Length > 50)
                    throw new ArgumentNullException("value", "Number field does not except a null or empty string as an argument.");
                _number = value;
            }
        }

        public DateTime DateCreated
        {
            get { return _dateCreated; }
            set
            {
                if (value > DateTime.Now)
                    throw new ArgumentOutOfRangeException("value", "Date Created cannot be a date in the future." );
                _dateCreated = value;
            }
        }

        public int Contact
        {
            get { return _contact; }
            set
            {
                if (value < 1)
                    throw new ArgumentNullException("value", "Contact field must have a value greater than 0.");
                _contact = value;
            }
        }

        public int Creator
        {
            get { return _creator; }
            set
            {
                if (value < 1)
                    throw new ArgumentNullException("value", "Creator field must have a value greater than 0.");
                _creator = value;
            }
        }

        public int Assigned
        {
            get { return _assigned; }
            set { _assigned = value; }
        }

        public TRACv2.Common.Enumerations.Issue Issue
        {
            get { return _issue; }
            set
            {
                    _issue = value;
            }
        }

        public TRACv2.Common.Enumerations.Priority Priority
        {
            get { return _priority; }
            set
            {
                    _priority = value;
            }
        }

        public TRACv2.Common.Enumerations.Status Status
        {
            get { return _status; }
            set
            {
                    _status = value;
            }
        }

        public string Note
        {
            get { return _note; }
            set { _note = value; }
        }

        #endregion

    }
}
